#region Imports

using System;
using System.Collections.Generic;
using d3PrtDgn.Core.BaseData;

#endregion

namespace d3PrtDgn.Data.Domain.Entity
{
	[Serializable]
    public class Phototype : BaseEntity
	{
		#region Private Members
		
		// Primary Key(s) 
		private int id; 
		
		// Properties 
		private string extension; 
		private string mime; 
		private string description; 
		
		#endregion
		
		#region Default ( Empty ) Class Constructor
		
		/// <summary>
		/// default constructor
		/// </summary>
		public Phototype()
		{
			id = 0; 
			extension = null; 
			mime = null; 
			description = null; 
		}
		
		#endregion // End of Default ( Empty ) Class Constructor
		
		#region Full Constructor
		
		/// <summary>
		/// full constructor
		/// </summary>
		public Phototype(int id, string extension, string mime, string description)
		{
			this.id = id;
			this.extension = extension;
			this.mime = mime;
			this.description = description;
		}
		
		#endregion // End Full Constructor
		
		#region Required Fields Only Constructor
		
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public Phototype(int id, string extension, string mime)
		{
			this.id = id;
			this.extension = extension;
			this.mime = mime;
			this.description = null;
		}
		
		#endregion // End Required Fields Only Constructor

		#region Public Properties
			
		/// <summary>
		/// Unique identifier
		/// </summary>		
		public virtual int Id
		{
			get { return id; }
			set { isChanged |= (id != value); id = value; }
		} 
	  
		/// <summary>
		/// Extension of image file
		/// </summary>		
		public virtual string Extension
		{
			get { return extension; }
			set	
			{
				if ( value != null )
					if( value.Length > 10)
						throw new ArgumentOutOfRangeException("Invalid value for Extension", value, value.ToString());
				
				isChanged |= (extension != value); extension = value;
			}
		} 
	  
		/// <summary>
		/// MIME type of image file
		/// </summary>		
		public virtual string Mime
		{
			get { return mime; }
			set	
			{
				if ( value != null )
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for Mime", value, value.ToString());
				
				isChanged |= (mime != value); mime = value;
			}
		} 
	  
		/// <summary>
		/// Human readable description of image type
		/// </summary>		
		public virtual string Description
		{
			get { return description; }
			set	
			{
				if ( value != null )
					if( value.Length > 100)
						throw new ArgumentOutOfRangeException("Invalid value for Description", value, value.ToString());
				
				isChanged |= (description != value); description = value;
			}
		} 
	  
		/// <summary>
		/// Returns whether or not the object has changed it's values.
		/// </summary>
		public virtual bool IsChanged
		{
			get { return isChanged; }
		}
		
		/// <summary>
		/// Returns whether or not the object has changed it's values.
		/// </summary>
		public virtual bool IsDeleted
		{
			get { return isDeleted; }
		}
		
		#endregion 
		
		#region Public Functions

		#endregion
		
		#region Equals And HashCode Overrides
		
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			Phototype castObj = (Phototype)obj; 
			return ( castObj != null ) &&
				( this.id == castObj.Id );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{ 
			int hash = 57; 
			hash = 27 * hash * this.id.GetHashCode();
					
			return hash;		
			
		}
		
		#endregion
		
	}
}